package com.deayalar.rodandov2.adapters;

import com.deayalar.rodandov2.R;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class AlertsAdapter extends ArrayAdapter<String>  {
	 
	private final Activity context;
	private final String[] title;
	private final Integer[] imageId;
	
	public AlertsAdapter(Activity context,String[] title, Integer[] imageId) {
		super(context, R.layout.alerts_list_item, title);
		this.context = context;
		this.title = title;
		this.imageId = imageId;
	}
	
	@Override
	public View getView(int position, View view, ViewGroup parent) {
		LayoutInflater inflater = context.getLayoutInflater();
		View rowView= inflater.inflate(R.layout.alerts_list_item, null, true);
		TextView txtTitle = (TextView) rowView.findViewById(R.id.alerts_name);
		ImageView imageView = (ImageView) rowView.findViewById(R.id.alerts_img);
		txtTitle.setText(title[position]);
		imageView.setImageResource(imageId[position]);
		return rowView;
	}

}
